<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('代理商交易额统计列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label style="width: 80px;">代理商编号：</label>
                                <input type="text" name="agentNum"/>
                            </li>
                            <li>
                                <label style="width: 80px;">代理商名称：</label>
                                <input type="text" name="agentName"/>
                            </li>
                            <li>
                                <label style="width: 80px;">所属代理商：</label>
                                <input type="text" name="belongAgent"/>
                            </li>
                            <li class="select-time">
                                <label style="width: 80px;">交易日期：</label>
                                <input type="text" readonly class="time-input"  placeholder="开始日期" name="params[start]"/>
                                <span>-</span>
                                <input type="text" readonly class="time-input"  placeholder="结束日期" name="params[end]"/>
                            </li>
                            <li class="select-time">
                                <label style="width: 80px;">创建日期：</label>
                                <input type="text" readonly class="time-input"  placeholder="开始日期" name="params[startDate]"/>
                                <span>-</span>
                                <input type="text" readonly class="time-input"  placeholder="结束日期" name="params[endDate]"/>
                            </li>
                            <li class="select-time">
                                <label style="width: 80px;">所属月份：</label>
                                <input type="text" readonly id="start-month" class="time-input"  placeholder="开始日期"  name="params[startDateMonth]"/>
                                <span>-</span>
                                <input type="text" readonly id="end-month" class="time-input"  placeholder="结束日期" name="params[endDateMonth]"/>
                            </li>
                             <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>
            <div class="col-sm-12 search-collapse">
                <span style="color: blue;font-style: initial">交易总额：</span>
                <span id="sumMoney" style="color: red;font-style: initial">0.00</span><span style="color: blue;font-style: initial"> 元</span>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="AgentAmount:agentAmount:export">
                    <i class="fa fa-download"></i> 导出
                </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('AgentAmount:agentAmount:edit')}]];
        var removeFlag = [[${@permission.hasPermi('AgentAmount:agentAmount:remove')}]];
        var prefix = ctx + "AgentAmount/agentAmount";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "代理商交易额统计",
                responseHandler:responseHandler,
                columns: [{
                    checkbox: true
                },
                {
                    field: 'agentNum',
                    title: '代理商编号'
                },
                {
                    field: 'agentName',
                    title: '代理商名称'
                },
                {
                    field: 'amount',
                    title: '交易金额',
                    formatter: function (value, row, index) {
                        return $.table.rmbFormatter(value);
                    }
                },
                {
                    field: 'belongAgent',
                    title: '所属代理商'
                },
                {
                    field: 'tradeDate',
                    title: '交易日期'
                },
                {
                    field: 'createDate',
                    title: '创建日期'
                },
                {
                    field: 'tradeMonth',
                    title: '交易所属月份'
                },
               ]
            };
            $.table.init(options);
        });
        layui.use('laydate', function(){
            var laydate = layui.laydate;
            laydate.render({
                elem: '#start-month'
                ,type: 'month'
            });
            laydate.render({
                elem: '#end-month'
                ,type: 'month'
            });
        });

        function responseHandler(res) {
            $("#sumMoney").text(res.data.sumMoney);
        }


    </script>
</body>
</html>